home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 52
/
Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso
/
Aminet
/
util
/
misc
/
sss.lha
/
sss
/
cod
/
splt.ei
< prev
Wrap
Text File
|
1994-06-20
|
2KB
|
75 lines
*******************************************************************************
* splt 1.1.2
*******************************************************************************
* INFO program core
* SYN splt[]
* MOD d0 0=OK, else E_xxxxxx (see defs.i)
* REQ _DOSBase dos.library pointer
*******************************************************************************
procedure splt[],d1-d7/a0-a2/a6
movea.l _DOSBase,a6
moveq.l #0,d7 ;chunk counter
moveq.l #0,d5 ;no error
move.l InFlSz,d4 ;source file size
repeat
StrU[d7,ExtnAdr,DgtNo] ;build extension
prt[#txt_wrting] ;a0 already saved
prt[#OutBs] ;show current chunk name
move.l #OutBs,d1 ;open new destination file
move.l #MODE_NEWFILE,d2
jsr (_LVOOpen,a6)
movea.l d0,a2 ;store filehandle
when d0.l ;if file opened successfully
move.l ChnkSz,d6 ;bytes to read
when.s d4«d6 ;if not enough bytes left
move.l d4,d6 ;read all remaining ones
ewhen
sub.l d6,d4 ;bytes left
repeat
move.l InFlHnd,d1 ;source filehandle
move.l WrkBufAdr,d2 ;destination buffer
when.s d6»=WrkBufLen
move.l WrkBufLen,d3 ;fill the work buffer
othw
move.l d6,d3 ;read only necessary data
ewhen
jsr (_LVORead,a6)
sub.l d0,d6 ;update bytes to write
move.l a2,d1 ;destination filehandle
move.l WrkBufAdr,d2 ;buffer
move.l d0,d3 ;write bytes read to destination
jsr (_LVOWrite,a6)
when.s d0<d3 ;if not all bytes written
moveq.l #E_DSTFL,d5 ;give error
ewhen ;('<' cos d0 could be -1)
until ~d6.l | d5 ;exit if buffer completely written
;or error on writing
othw
moveq.l #E_DSTFL,d5 ;error opening destination!
exit ;exit repeat...until
ewhen
move.l a2,d1 ;close destination file
jsr (_LVOClose,a6)
move.l ChkBrk[],d5 ;check if CTRL-C
addq.l #1,d7 ;next chunk
until {d7.l»MaxChnk} | d5 ;exit if chunks over
;or error
prt[#txt_ENTER]
move.l d5,d0 ;ErrCode
eproc